package cate.game.play.buff.h;

import cate.common.table.d.GDSkill;
import cate.common.util.XT;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import easy.java.struct.ref.DoubleRef;

import java.util.List;

/**
 * 受致死伤害时强制血量为1,（受到真实伤害和被斩杀除外）当前伤害结束后恢复25%生命值，获得15%伤害减免2回合并清除此状态，
 * 处于【圣光】状态下不会触发【圣甲】
 */
public class 圣甲BH extends BuffHandler {

	private String 圣光标签;

	private List<Integer> 结束buff;

	//圣光标签=？？&结束buff=？？#？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		圣光标签 = args.get("圣光标签");
		结束buff = args.getIntList("结束buff");
	}

	@Override
	public void adjustDeadlyDamage(ActionCtx action, Fighter actor, int reason, DoubleRef doubleRef) {
		if (buff.owner.buff.containTags(圣光标签)) {
			return;
		}
		doubleRef.v = buff.owner.attr.hpCur() - 1;
		if(XT.isNotBlank(结束buff)){
			for (Integer buffTid : 结束buff) {
				buff.owner.buff.tryAddByTid(action, buffTid);
			}
		}
		buff.markInvalid(action);
	}
}
